home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / axxwar_1.zip / SOURCES / ITEMS.QC < prev    next >
Text File  |  1997-03-08  |  37KB  |  1,654 lines

  1. // AxxWars v0.8
  2.  
  3. void() W_SetCurrentAmmo;
  4. void(vector org, vector vel) SpawnMeatSpray;     // AXXSH
  5. void() BecomeExplosion;                // AXXEB
  6.  
  7. /* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
  8. BE .8 .3 .4 IN COLOR */
  9.  
  10. void() NormalRegen =  // AXXRI
  11. // void() SUB_regen = // Original code 
  12.  {    self.model = self.mdl;        // restore original model
  13.     self.solid = SOLID_TRIGGER;    // allow it to be touched again
  14.     sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);    // play respawn sound
  15.     setorigin (self, self.origin);
  16.  };
  17.  
  18. /*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
  19. prints a warning message when spawned
  20. */
  21. void() noclass =
  22. {
  23.     dprint ("noclass spawned at");
  24.     dprint (vtos(self.origin));
  25.     dprint ("\n");
  26.     remove (self);
  27. };
  28.  
  29.  
  30.  
  31. /*
  32. ============
  33. PlaceItem
  34.  
  35. plants the object on the floor
  36. ============
  37. */
  38. void() PlaceItem =
  39. {
  40.     local float    oldz;
  41.  
  42.     self.mdl = self.model;        // so it can be restored on respawn
  43.     self.flags = FL_ITEM;        // make extra wide
  44.     self.solid = SOLID_TRIGGER;
  45.     self.movetype = MOVETYPE_TOSS;    
  46.     self.velocity = '0 0 0';
  47.     self.origin_z = self.origin_z + 6;
  48.     oldz = self.origin_z;
  49.     if (!droptofloor())
  50.     {
  51.         dprint ("Bonus item fell out of level at ");
  52.         dprint (vtos(self.origin));
  53.         dprint ("\n");
  54.         remove(self);
  55.         return;
  56.     }
  57. };
  58.  
  59. /*
  60. ============
  61. StartItem
  62.  
  63. Sets the clipping size and plants the object on the floor
  64. ============
  65. */
  66. void() StartItem =
  67. {
  68.     self.nextthink = time + 0.2;    // items start after other solids
  69.     self.think = PlaceItem;
  70. };
  71.  
  72. /*
  73. =========================================================================
  74.  
  75. HEALTH BOX
  76.  
  77. =========================================================================
  78. */
  79. //
  80. // T_Heal: add health to an entity, limiting health to max_health
  81. // "ignore" will ignore max_health limit
  82. //
  83. float (entity e, float healamount, float ignore) T_Heal =
  84. {
  85.     if (e.health <= 0)
  86.         return 0;
  87.     if ((!ignore) && (e.health >= other.max_health))
  88.         return 0;
  89.     healamount = ceil(healamount);
  90.  
  91.     e.health = e.health + healamount;
  92.     if ((!ignore) && (e.health >= other.max_health))
  93.         e.health = other.max_health;
  94.  
  95.     if (e.health > 250)
  96.         e.health = 250;
  97.     return 1;
  98. };
  99.  
  100. /*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
  101. Health box. Normally gives 25 points.
  102. Rotten box heals 5-10 points,
  103. megahealth will add 100 health, then 
  104. rot you down to your maximum health limit, 
  105. one point per second.
  106. */
  107.  
  108. float    H_ROTTEN = 1;
  109. float    H_MEGA = 2;
  110. .float    healamount, healtype;
  111. void() health_touch;
  112. void() item_megahealth_rot;
  113.  
  114. void() item_health =
  115. {    
  116.     self.touch = health_touch;
  117.  
  118.     if (self.spawnflags & H_ROTTEN)
  119.     {
  120.         precache_model("maps/b_bh10.bsp");
  121.  
  122.         precache_sound("items/r_item1.wav");
  123.         setmodel(self, "maps/b_bh10.bsp");
  124.         self.noise = "items/r_item1.wav";
  125.         self.healamount = 15;
  126.         self.healtype = 0;
  127.     }
  128.     else
  129.     if (self.spawnflags & H_MEGA)
  130.     {
  131.         precache_model("maps/b_bh100.bsp");
  132.         precache_sound("items/r_item2.wav");
  133.         setmodel(self, "maps/b_bh100.bsp");
  134.         self.noise = "items/r_item2.wav";
  135.         self.healamount = 100;
  136.         self.healtype = 2;
  137.     }
  138.     else
  139.     {
  140.         precache_model("maps/b_bh25.bsp");
  141.         precache_sound("items/health1.wav");
  142.         setmodel(self, "maps/b_bh25.bsp");
  143.         self.noise = "items/health1.wav";
  144.         self.healamount = 25;
  145.         self.healtype = 1;
  146.     }
  147.     setsize (self, '0 0 0', '32 32 56');
  148.     StartItem ();
  149. };
  150.  
  151.  
  152. void() health_touch =
  153. {
  154.     local    float amount;
  155.     local    string    s;
  156.     
  157.    if ((other.classname != "player") && (other.classname != "cbot")) // AXXEL
  158. // if (other.classname != "player") // Original code
  159.         return;
  160.     
  161.     if (self.healtype == 2) // Megahealth?  Ignore max_health...
  162.     {
  163.         if ((other.classname == "player") && (other.runepower == 5))
  164.             {    other.runepower = 0;
  165.                 stuffcmd(other, "fov 90\n");
  166.             }
  167.  
  168.         if (other.health >= 250)
  169.             return;
  170.         if (!T_Heal(other, self.healamount, 1))
  171.             return;
  172.     }
  173.     else
  174.     {
  175.         if (!T_Heal(other, self.healamount, 0))
  176.             return;
  177.     }
  178.     
  179. // AXXEL START
  180.  if (other.classname == "player") 
  181.         {
  182. // AXXEL END
  183.  
  184. // AXXCL Remove start
  185. //    sprint(other, "You receive ");
  186. //    s = ftos(self.healamount);
  187. //    sprint(other, s);
  188. //    sprint(other, " health\n");
  189. // AXXCL Remove end
  190.     stuffcmd (other, "bf\n");
  191. } // AXXEL 
  192.  
  193.     // health touch sound
  194.     sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  195.     self.model = string_null;
  196.     self.solid = SOLID_NOT;
  197.  
  198.     // Megahealth = rot down the player's super health
  199.     if (self.healtype == 2)
  200.     {
  201.         other.items = other.items | IT_SUPERHEALTH;
  202.         self.nextthink = time + 5;
  203.         self.think = item_megahealth_rot;
  204.         self.owner = other;
  205.     }
  206.     else
  207.     {
  208. //        if (deathmatch != 2)        // AXXRI Remove
  209.         {
  210.             if (deathmatch)
  211.                 self.nextthink = time + 20;
  212.             self.think = SUB_regen;
  213.         }
  214.     }
  215.     
  216.     activator = other;
  217.     SUB_UseTargets();                // fire all targets / killtargets
  218. };    
  219.  
  220. /*
  221. ===================
  222. item_megahealth_rot
  223. ===================
  224. */
  225.  
  226. void() item_megahealth_rot =
  227. {
  228.     other = self.owner;
  229.     
  230.     if (other.health > other.max_health)
  231.     {
  232.         other.health = other.health - 1;
  233.         self.nextthink = time + 1;
  234.         return;
  235.     }
  236.  
  237. // it is possible for a player to die and respawn between rots, so don't
  238. // just blindly subtract the flag off
  239.     other.items = other.items - (other.items & IT_SUPERHEALTH);
  240.     
  241. //    if (deathmatch == 1)    // AXXRI Remove
  242.     {
  243.         self.nextthink = time + 20;
  244.         self.think = SUB_regen;
  245.     }
  246. };
  247.  
  248. void() armor_touch;
  249. void (entity old_ent) blaze_extinguishentity; // AXXBL
  250.  
  251. /*
  252. ===========
  253. Armor_Touch
  254. ===========
  255. */
  256.  
  257. void() armor_touch =
  258. {
  259.     local    float    type, value, bit;
  260.     local   entity  temp;            // AXXCU
  261.     
  262.     
  263.     if (other.health <= 0)
  264.         return;
  265.    if ((other.classname != "player") && (other.classname != "cbot")) // AXXEL
  266. // if (other.classname != "player") // Original code
  267.         return;
  268.  
  269.     if (self.classname == "item_armor1")
  270.     {
  271.         type = 0.3;
  272.         value = 100;
  273.         bit = IT_ARMOR1;
  274.         other.pi3 = 1; // AXXEL
  275.     }
  276.     if (self.classname == "item_armor2")
  277.     {
  278.         type = 0.6;
  279.         value = 150;
  280.         bit = IT_ARMOR2;
  281. // AXXEL START
  282.         other.pi2 = 1;
  283.         other.pi3 = 1;
  284. // AXXEL END 
  285.     }
  286.     if (self.classname == "item_armorInv")
  287.     {
  288.         type = 0.8;
  289.         value = 200;
  290.         bit = IT_ARMOR3;
  291. // AXXEL START
  292.         other.pi1 = 1;
  293.         other.pi2 = 1;
  294.         other.pi3 = 1;
  295. // AXXEL END
  296.     }
  297.  
  298. // AXXCU START
  299. // ALWAYS pick up the yellow Cujo armor, even if the player's
  300. // armor is better
  301.     if ((other.armortype*other.armorvalue >= type*value) && (value != 150))
  302.           return;
  303. // if the player's armor is currently better, don't reset it
  304.       if (other.armortype*other.armorvalue < type*value)
  305.         {
  306.         other.armortype = type;
  307.       other.armorvalue = value;
  308.       other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
  309.         }
  310. // AXXCU END
  311.  
  312. // Original code start
  313. //    if (other.armortype*other.armorvalue >= type*value)
  314. //        return;
  315. //    other.armortype = type;
  316. //    other.armorvalue = value;
  317. //    other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
  318. // Original code end
  319.  
  320.     self.solid = SOLID_NOT;
  321.     self.model = string_null;
  322. //    if (deathmatch == 1)    // AXXRI Remove
  323.         self.nextthink = time + 20;
  324.     self.think = SUB_regen;
  325.     sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
  326.  
  327. // AXXEL START
  328. if (other.classname == "player")
  329.         {
  330. // AXXEL END
  331.  
  332. // AXXCU START
  333. // if they picked up a Cujo armor, let them know
  334.  
  335.         if ((value == cujo_armorval) && (deathmatch))
  336.         {
  337.  
  338. if (!other.Cujo_flag)    // AXXCL
  339. {                // AXXCL
  340.  
  341.  
  342. // AXXCL Delete start
  343. //    if (other.Cujo_flag)
  344. //
  345. //          sprint (other, "You got armor\n");
  346. //          else
  347. //          {
  348. //          sprint (other, "You got armor and a Cujo bot!\n");
  349. // AXXCL Delete end
  350.             // spawn Cujo now!
  351.             temp = self;
  352.             self = other;
  353.             self.Cujo_avail = 1;
  354.             cujo_org = temp.origin;
  355.             CUJO_Toggle ();
  356.             self = temp;
  357.           }    
  358.         }
  359.         else
  360. //          sprint(other, "You got armor\n");    AXXCL Delete
  361. // AXXCU END
  362.  
  363.         blaze_extinguishentity (other); // AXXBL
  364.  
  365. // Original code start
  366. //    sprint(other, "You got armor\n");
  367. // armor touch sound
  368. //    sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
  369. // Original code end
  370.  
  371.     stuffcmd (other, "bf\n");
  372.  
  373. } // AXXEL
  374.     
  375.     activator = other;
  376.     SUB_UseTargets();                // fire all targets / killtargets
  377. };
  378.  
  379.  
  380. /*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
  381. */
  382.  
  383. void() item_armor1 =
  384. {
  385.     self.touch = armor_touch;
  386.     precache_model ("progs/armor.mdl");
  387.     setmodel (self, "progs/armor.mdl");
  388.     self.skin = 0;
  389.     setsize (self, '-16 -16 0', '16 16 56');
  390.     StartItem ();
  391. };
  392.  
  393. /*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
  394. */
  395.  
  396. void() item_armor2 =
  397. {
  398.     self.touch = armor_touch;
  399.     precache_model ("progs/armor.mdl");
  400.     setmodel (self, "progs/armor.mdl");
  401.     self.skin = 1;
  402.     setsize (self, '-16 -16 0', '16 16 56');
  403.     StartItem ();
  404. };
  405.  
  406. /*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
  407. */
  408.  
  409. void() item_armorInv =
  410. {
  411.     self.touch = armor_touch;
  412.     precache_model ("progs/armor.mdl");
  413.     setmodel (self, "progs/armor.mdl");
  414.     self.skin = 2;
  415.     setsize (self, '-16 -16 0', '16 16 56');
  416.     StartItem ();
  417. };
  418.  
  419. /*
  420. ===============================================================================
  421.  
  422. WEAPONS
  423.  
  424. ===============================================================================
  425. */
  426.  
  427. void() bound_other_ammo =
  428. {
  429.     if (other.ammo_shells > 100)
  430.         other.ammo_shells = 100;
  431.     if (other.ammo_nails > 200)
  432.         other.ammo_nails = 200;
  433.  
  434. // AXXRG START
  435.     if (other.ammo_rockets > 20)
  436.         other.ammo_rockets = 20;
  437.     if (other.ammo_cells > 200)
  438.         other.ammo_cells = 200;    
  439. // AXXRG END
  440. // Original code start
  441. //    if (other.ammo_rockets > 100)
  442. //        other.ammo_rockets = 100;
  443. //     if (other.ammo_cells > 100)
  444. //        other.ammo_cells = 100;
  445. // Original code end    
  446.  
  447.         
  448. };
  449.  
  450.  
  451. float(float w) RankForWeapon =
  452. {
  453.     if (w == IT_LIGHTNING)
  454.         return 1;
  455.     if (w == IT_ROCKET_LAUNCHER)
  456.         return 2;
  457.     if (w == IT_SUPER_NAILGUN)
  458.         return 3;
  459.     if (w == IT_GRENADE_LAUNCHER)
  460.         return 4;
  461.     if (w == IT_SUPER_SHOTGUN)
  462.         return 5;
  463.     if (w == IT_NAILGUN)
  464.         return 6;
  465.     return 7;
  466. };
  467.  
  468.  
  469.  
  470.      /*
  471.     =============
  472.     Deathmatch_Weapon
  473.  
  474.     Deathmatch weapon change rules for picking up a weapon
  475.  
  476.     .float        ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
  477.     =============
  478.     */
  479.     void(float old, float new) Deathmatch_Weapon =
  480.  
  481.  
  482.     {
  483.     local float or, nr;
  484.  
  485. // change self.weapon if desired
  486.     or = RankForWeapon (self.weapon);
  487.     nr = RankForWeapon (new);
  488.     if ( nr < or )
  489.     {    self.PW_prevweapon = self.weapon;
  490.         self.weapon = new;    }
  491. };
  492.  
  493. /*
  494. =============
  495. weapon_touch
  496. =============
  497. */
  498. float() W_BestWeapon;
  499.  
  500. void() weapon_touch =
  501. {
  502.     local    float    best, new, get, old;
  503.     local    entity    stemp;
  504.     local    float    leave;
  505.  
  506. // AXXSH START
  507. if (other.class) return;
  508. // AXXSH END
  509.  
  510.  
  511. if ((!(other.flags & FL_CLIENT)) && (other.classname != "cbot")) // AXXEL
  512. // if (!(other.flags & FL_CLIENT)) // Original code
  513.         return;
  514.     
  515. // if the player was using his best weapon, change up to the new one if better        
  516.     stemp = self;
  517.     self = other;
  518.     best = W_BestWeapon();
  519.     self = stemp;
  520.  
  521.     if (deathmatch == 2 || coop)
  522.         leave = 1;
  523.     else
  524.         leave = 0;
  525.     
  526.     if (self.classname == "weapon_supernailgun")
  527.     {
  528.         if (leave && (other.items & IT_SUPER_NAILGUN) )
  529.             return;
  530.         new = (IT_SUPER_NAILGUN);// | IT_BLAZEGUN);
  531.         get = IT_SUPER_NAILGUN;
  532.         other.ammo_nails = other.ammo_nails + 30;
  533.         other.pi7 = 1; // AXXEL
  534.     }
  535.     else if (self.classname == "weapon_supershotgun")
  536.         {
  537.         if (other.classname == "cbot")
  538.             {
  539.             if (leave && (other.items & IT_SUPER_SHOTGUN) )
  540.                 return;
  541.             new = IT_SUPER_SHOTGUN;
  542.             get = IT_SUPER_SHOTGUN;
  543.             other.ammo_shells = other.ammo_shells + 5;
  544.             other.pi9 = 1; // AXXEL
  545.             }
  546.         else
  547.             {
  548.             if (leave && (other.items & IT_SNIPER) )
  549.                 return;
  550.             new = IT_SNIPER;
  551.             get = IT_SNIPER;
  552.             centerprint (other, "Snipergun available.");
  553.             other.ammo_shells = other.ammo_shells + 5;
  554.             other.pi9 = 1; // AXXEL    
  555.             }
  556.         }
  557.     else if (self.classname == "weapon_nailgun")
  558.     {
  559.         if (leave && (other.items & IT_NAILGUN) )
  560.             return;
  561.         new = IT_NAILGUN;
  562.         get = IT_NAILGUN;
  563.         other.ammo_nails = other.ammo_nails + 30;
  564.         other.pi8 = 1; // AXXEL
  565.     }
  566.     else if (self.classname == "weapon_rocketlauncher")
  567.     {
  568.         if (leave && (other.items & IT_ROCKET_LAUNCHER) )
  569.             return;
  570.         new = (IT_ROCKET_LAUNCHER | IT_SEEKER);
  571.         get = IT_ROCKET_LAUNCHER;
  572.         other.ammo_rockets = other.ammo_rockets + 5;
  573.         other.pi4 = 1; // AXXEL
  574.     }
  575.     else if (self.classname == "weapon_grenadelauncher")
  576.     {
  577.         if (leave && (other.items & IT_GRENADE_LAUNCHER) )
  578.             return;
  579.         new = IT_GRENADE_LAUNCHER;
  580.         get = IT_GRENADE_LAUNCHER;
  581.         other.ammo_rockets = other.ammo_rockets + 5;        
  582.         other.pi6 = 1; // AXXEL    
  583.     }
  584.     else if (self.classname == "weapon_lightning")
  585.     {
  586.         if (leave && (other.items & IT_LIGHTNING) )
  587.             return;
  588.         new = IT_LIGHTNING;
  589.         get = IT_LIGHTNING;
  590.         other.ammo_cells = other.ammo_cells + 15;
  591.         other.pi5 = 1;
  592.     }
  593.     else
  594.         objerror ("weapon_touch: unknown classname");
  595.  
  596. // AXXEL START
  597.      if (other.classname == "player")
  598.         {
  599. // AXXEL END
  600.  
  601. // AXXCL Start delete
  602. //    sprint (other, "You got the ");
  603. //    sprint (other, self.netname);
  604. //    sprint (other, "\n");
  605. // AXXCL End delete
  606.  
  607.     stuffcmd (other, "bf\n");
  608. } // AXXEL
  609.  
  610.     // weapon touch sound
  611.     sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  612.     bound_other_ammo ();
  613.  
  614. // change to the weapon
  615.     old = other.items;
  616.     other.items = other.items | new;
  617.  
  618.     stemp = self;
  619.     self = other;
  620.     
  621.     old_weapon = self.weapon;
  622.  
  623. if (!deathmatch)
  624.         self.weapon = get;
  625.     else
  626.         Deathmatch_Weapon (old, get);
  627.  
  628.  
  629. // AXXEL START
  630.         if (self.classname == "player")
  631.                 W_SetCurrentAmmo();
  632.         if (self.classname == "cbot")
  633.                 cbot_set_ammo();
  634. // AXXEL END
  635. // W_SetCurrentAmmo(); original code
  636.  
  637.     self = stemp;
  638.  
  639.     if (leave)
  640.         return;
  641.  
  642. // remove it in single player, or setup for respawning in deathmatch
  643.     self.model = string_null;
  644.     self.solid = SOLID_NOT;
  645.     if (deathmatch == 1)
  646.         self.nextthink = time + 30;
  647.     self.think = SUB_regen;
  648.     
  649.     activator = other;
  650.     SUB_UseTargets();                // fire all targets / killtargets
  651. };
  652.  
  653.  
  654. /*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
  655. */
  656.  
  657. void() weapon_supershotgun =
  658. {
  659.     precache_model ("progs/g_shot.mdl");
  660.     setmodel (self, "progs/g_shot.mdl");
  661.     self.weapon = IT_SUPER_SHOTGUN;
  662.     self.netname = "Double-barrelled Shotgun";
  663.     self.touch = weapon_touch;
  664.     setsize (self, '-16 -16 0', '16 16 56');
  665.     StartItem ();
  666. };
  667.  
  668. /*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  669. */
  670.  
  671. void() weapon_nailgun =
  672. {
  673.     precache_model ("progs/g_nail.mdl");
  674.     setmodel (self, "progs/g_nail.mdl");
  675.     self.weapon = IT_NAILGUN;
  676.     self.netname = "nailgun";
  677.     self.touch = weapon_touch;
  678.     setsize (self, '-16 -16 0', '16 16 56');
  679.     StartItem ();
  680. };
  681.  
  682. /*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  683. */
  684.  
  685. void() weapon_supernailgun =
  686. {
  687.     precache_model ("progs/g_nail2.mdl");
  688.     setmodel (self, "progs/g_nail2.mdl");
  689.     self.weapon = IT_SUPER_NAILGUN;
  690.     self.netname = "Perforator";
  691.     self.touch = weapon_touch;
  692.     setsize (self, '-16 -16 0', '16 16 56');
  693.     StartItem ();
  694. };
  695.  
  696. /*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  697. */
  698.  
  699. void() weapon_grenadelauncher =
  700. {
  701.     precache_model ("progs/g_rock.mdl");
  702.     setmodel (self, "progs/g_rock.mdl");
  703.     self.weapon = 3;
  704.     self.netname = "Grenade Launcher";
  705.     self.touch = weapon_touch;
  706.     setsize (self, '-16 -16 0', '16 16 56');
  707.     StartItem ();
  708. };
  709.  
  710. /*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  711. */
  712.  
  713. void() weapon_rocketlauncher =
  714. {
  715.     precache_model ("progs/g_rock2.mdl");
  716.     setmodel (self, "progs/g_rock2.mdl");
  717.     self.weapon = 3;
  718.     self.netname = "Rocket Launcher";
  719.     self.touch = weapon_touch;
  720.     setsize (self, '-16 -16 0', '16 16 56');
  721.     StartItem ();
  722. };
  723.  
  724.  
  725. /*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
  726. */
  727.  
  728. void() weapon_lightning =
  729. {
  730.     precache_model ("progs/g_light.mdl");
  731.     setmodel (self, "progs/g_light.mdl");
  732.     self.weapon = 3;
  733.     self.netname = "Thunderbolt";
  734.     self.touch = weapon_touch;
  735.     setsize (self, '-16 -16 0', '16 16 56');
  736.     StartItem ();
  737. };
  738.  
  739. /*
  740. ===============================================================================
  741.  
  742. AMMO
  743.  
  744. ===============================================================================
  745. */
  746.  
  747. void() ammo_touch =
  748. {
  749. local entity    stemp;
  750. local float    best;
  751.  
  752. if ((other.classname != "player") && (other.classname != "cbot")) // AXXEL
  753. // if (other.classname != "player") // Original code
  754.         return;
  755.     if (other.health <= 0)
  756.         return;
  757.  
  758.     // AXXSH START
  759.     if (other.class) return;
  760.     // AXXSH END
  761.  
  762.  
  763. // if the player was using his best weapon, change up to the new one if better        
  764.     stemp = self;
  765.     self = other;
  766.     old_weapon = self.weapon;
  767.     if (self.classname == "player")    // AXXEL
  768.         best = W_BestWeapon();
  769. // AXXEL START
  770.     else
  771.         best = cbot_best_weapon();
  772. // AXXEL END
  773.     self = stemp;
  774.  
  775.  
  776. // shotgun
  777.     if (self.weapon == 1)
  778.     {
  779.         if (other.ammo_shells >= 100)
  780.             return;
  781.         other.ammo_shells = other.ammo_shells + self.aflag;
  782.     }
  783.  
  784. // spikes
  785.     if (self.weapon == 2)
  786.     {
  787.         if (other.ammo_nails >= 200)
  788.             return;
  789.         other.ammo_nails = other.ammo_nails + self.aflag;
  790.     }
  791.  
  792. //    rockets
  793.     if (self.weapon == 3)
  794.     {
  795.     if (other.ammo_rockets >= 20)  // AXXRG
  796. //    if (other.ammo_rockets >= 100) // Original code
  797.             return;
  798.         other.ammo_rockets = other.ammo_rockets + self.aflag;
  799.     }
  800.  
  801. //    cells
  802.     if (self.weapon == 4)
  803.     {
  804.         if (other.ammo_cells >= 100)
  805.             return;
  806.         other.ammo_cells = other.ammo_cells + self.aflag;
  807.     }
  808.  
  809.     bound_other_ammo ();
  810.  
  811. // AXXEL START
  812.      if (other.classname == "player")
  813.         {
  814. // AXXEL END
  815.  
  816. // AXXCL Remove start
  817. //    sprint (other, "You got the ");
  818. //    sprint (other, self.netname);
  819. //    sprint (other, "\n");
  820. // AXXCL Remove end    
  821.     stuffcmd (other, "bf\n");
  822.     } // AXXEL
  823.  
  824. // ammo touch sound
  825.     sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  826.     
  827. // change to a better weapon if appropriate
  828.  
  829.     if ( other.weapon == best )
  830.     {
  831.         stemp = self;
  832.         self = other;
  833.         old_weapon = self.weapon;
  834. // AXXEL START
  835.     if (self.classname == "player")
  836.         {    
  837. // AXXEL END
  838.             self.PW_prevweapon = self.weapon; // AXXAF
  839.             self.weapon = W_BestWeapon();
  840.             W_SetCurrentAmmo ();
  841. // AXXEL START
  842.         }
  843.         else
  844.         {  
  845.           self.weapon = cbot_best_weapon();
  846.           cbot_set_ammo();
  847.         }
  848. // AXXEL END
  849.         self = stemp;
  850.     }
  851.  
  852. // if changed current ammo, update it
  853.     stemp = self;
  854.     self = other;
  855. if (self.classname == "player")    // AXXEL
  856.         W_SetCurrentAmmo();
  857.     else    cbot_set_ammo();    // AXXEL
  858.     self = stemp;
  859.  
  860.  
  861. // remove it in single player, or setup for respawning in deathmatch
  862.     self.model = string_null;
  863.     self.solid = SOLID_NOT;
  864. //    if (deathmatch == 1)    // AXXRI Remove
  865.         self.nextthink = time + 30;
  866.     self.think = SUB_regen;
  867.  
  868.     activator = other;
  869.     SUB_UseTargets();                // fire all targets / killtargets
  870. };
  871.  
  872.  
  873. float WEAPON_BIG2 = 1;
  874.  
  875. /*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
  876. */
  877.  
  878. void() item_shells =
  879. {
  880.     self.touch = ammo_touch;
  881.  
  882.     if (self.spawnflags & WEAPON_BIG2)
  883.     {
  884.         precache_model ("maps/b_shell1.bsp");
  885.         setmodel (self, "maps/b_shell1.bsp");
  886.         self.aflag = 40;
  887.     }
  888.     else
  889.     {
  890.         precache_model ("maps/b_shell0.bsp");
  891.         setmodel (self, "maps/b_shell0.bsp");
  892.         self.aflag = 20;
  893.     }
  894.     self.weapon = 1;
  895.     self.netname = "shells";
  896.     setsize (self, '0 0 0', '32 32 56');
  897.     StartItem ();
  898. };
  899.  
  900. /*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
  901. */
  902.  
  903. void() item_spikes =
  904. {
  905.     self.touch = ammo_touch;
  906.  
  907.     if (self.spawnflags & WEAPON_BIG2)
  908.     {
  909.         precache_model ("maps/b_nail1.bsp");
  910.         setmodel (self, "maps/b_nail1.bsp");
  911.         self.aflag = 50;
  912.     }
  913.     else
  914.     {
  915.         precache_model ("maps/b_nail0.bsp");
  916.         setmodel (self, "maps/b_nail0.bsp");
  917.         self.aflag = 25;
  918.     }
  919.     self.weapon = 2;
  920.     self.netname = "nails";
  921.     setsize (self, '0 0 0', '32 32 56');
  922.     StartItem ();
  923. };
  924.  
  925. /*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
  926. */
  927.  
  928. void() item_rockets =
  929. {
  930.     self.touch = ammo_touch;
  931.  
  932.     if (self.spawnflags & WEAPON_BIG2)
  933.     {
  934.         precache_model ("maps/b_rock1.bsp");
  935.         setmodel (self, "maps/b_rock1.bsp");
  936.         self.aflag = 10;
  937.     }
  938.     else
  939.     {
  940.         precache_model ("maps/b_rock0.bsp");
  941.         setmodel (self, "maps/b_rock0.bsp");
  942.         self.aflag = 5;
  943.     }
  944.     self.weapon = 3;
  945.     self.netname = "rockets";
  946.     setsize (self, '0 0 0', '32 32 56');
  947.     StartItem ();
  948. };
  949.  
  950.  
  951. /*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
  952. */
  953.  
  954. void() item_cells =
  955. {
  956.     self.touch = ammo_touch;
  957.  
  958.     if (self.spawnflags & WEAPON_BIG2)
  959.     {
  960.         precache_model ("maps/b_batt1.bsp");
  961.         setmodel (self, "maps/b_batt1.bsp");
  962.         self.aflag = 12;
  963.     }
  964.     else
  965.     {
  966.         precache_model ("maps/b_batt0.bsp");
  967.         setmodel (self, "maps/b_batt0.bsp");
  968.         self.aflag = 6;
  969.     }
  970.     self.weapon = 4;
  971.     self.netname = "cells";
  972.     setsize (self, '0 0 0', '32 32 56');
  973.     StartItem ();
  974. };
  975.  
  976.  
  977. /*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
  978. DO NOT USE THIS!!!! IT WILL BE REMOVED!
  979. */
  980.  
  981. float WEAPON_SHOTGUN = 1;
  982. float WEAPON_ROCKET = 2;
  983. float WEAPON_SPIKES = 4;
  984. float WEAPON_BIG = 8;
  985. void() item_weapon =
  986. {
  987.     self.touch = ammo_touch;
  988.  
  989.     if (self.spawnflags & WEAPON_SHOTGUN)
  990.     {
  991.         if (self.spawnflags & WEAPON_BIG)
  992.         {
  993.             precache_model ("maps/b_shell1.bsp");
  994.             setmodel (self, "maps/b_shell1.bsp");
  995.             self.aflag = 40;
  996.         }
  997.         else
  998.         {
  999.             precache_model ("maps/b_shell0.bsp");
  1000.             setmodel (self, "maps/b_shell0.bsp");
  1001.             self.aflag = 20;
  1002.         }
  1003.         self.weapon = 1;
  1004.         self.netname = "shells";
  1005.     }
  1006.  
  1007.     if (self.spawnflags & WEAPON_SPIKES)
  1008.     {
  1009.         if (self.spawnflags & WEAPON_BIG)
  1010.         {
  1011.             precache_model ("maps/b_nail1.bsp");
  1012.             setmodel (self, "maps/b_nail1.bsp");
  1013.             self.aflag = 40;
  1014.         }
  1015.         else
  1016.         {
  1017.             precache_model ("maps/b_nail0.bsp");
  1018.             setmodel (self, "maps/b_nail0.bsp");
  1019.             self.aflag = 20;
  1020.         }
  1021.         self.weapon = 2;
  1022.         self.netname = "spikes";
  1023.     }
  1024.  
  1025.     if (self.spawnflags & WEAPON_ROCKET)
  1026.     {
  1027.         if (self.spawnflags & WEAPON_BIG)
  1028.         {
  1029.             precache_model ("maps/b_rock1.bsp");
  1030.             setmodel (self, "maps/b_rock1.bsp");
  1031.             self.aflag = 10;
  1032.         }
  1033.         else
  1034.         {
  1035.             precache_model ("maps/b_rock0.bsp");
  1036.             setmodel (self, "maps/b_rock0.bsp");
  1037.             self.aflag = 5;
  1038.         }
  1039.         self.weapon = 3;
  1040.         self.netname = "rockets";
  1041.     }
  1042.     
  1043.     setsize (self, '0 0 0', '32 32 56');
  1044.     StartItem ();
  1045. };
  1046.  
  1047.  
  1048. /*
  1049. ===============================================================================
  1050.  
  1051. KEYS
  1052.  
  1053. ===============================================================================
  1054. */
  1055.  
  1056. void() key_touch =
  1057. {
  1058. local entity    stemp;
  1059. local float        best;
  1060.  
  1061.     if (other.classname != "player")
  1062.         return;
  1063.     if (other.health <= 0)
  1064.         return;
  1065.     if (other.items & self.items)
  1066.         return;
  1067.  
  1068.     sprint (other, "You got the ");
  1069.     sprint (other, self.netname);
  1070.     sprint (other,"\n");
  1071.  
  1072.     sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  1073.     stuffcmd (other, "bf\n");
  1074.     other.items = other.items | self.items;
  1075.  
  1076.     if (!coop)
  1077.     {    
  1078.         self.solid = SOLID_NOT;
  1079.         self.model = string_null;
  1080.     }
  1081.  
  1082.     activator = other;
  1083.     SUB_UseTargets();                // fire all targets / killtargets
  1084. };
  1085.  
  1086.  
  1087. void() key_setsounds =
  1088. {
  1089.     if (world.worldtype == 0)
  1090.     {
  1091.         precache_sound ("misc/medkey.wav");
  1092.         self.noise = "misc/medkey.wav";
  1093.     }
  1094.     if (world.worldtype == 1)
  1095.     {
  1096.         precache_sound ("misc/runekey.wav");
  1097.         self.noise = "misc/runekey.wav";
  1098.     }
  1099.     if (world.worldtype == 2)
  1100.     {
  1101.         precache_sound2 ("misc/basekey.wav");
  1102.         self.noise = "misc/basekey.wav";
  1103.     }
  1104. };
  1105.  
  1106. /*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32)
  1107. SILVER key
  1108. In order for keys to work
  1109. you MUST set your maps
  1110. worldtype to one of the
  1111. following:
  1112. 0: medieval
  1113. 1: metal
  1114. 2: base
  1115. */
  1116.  
  1117. void() item_key1 =
  1118. {
  1119.     if (world.worldtype == 0)
  1120.     {
  1121.         precache_model ("progs/w_s_key.mdl");
  1122.         setmodel (self, "progs/w_s_key.mdl");
  1123.         self.netname = "silver key";
  1124.     }
  1125.     else if (world.worldtype == 1)
  1126.     {
  1127. //        precache_model ("progs/m_s_key.mdl"); // AXXSH DELETE
  1128.         setmodel (self, "progs/m_s_key.mdl");
  1129.         self.netname = "silver runekey";
  1130.     }
  1131.     else if (world.worldtype == 2)
  1132.     {
  1133.         precache_model2 ("progs/b_s_key.mdl");
  1134.         setmodel (self, "progs/b_s_key.mdl");
  1135.         self.netname = "silver keycard";
  1136.     }
  1137.     key_setsounds();
  1138.     self.touch = key_touch;
  1139.     self.items = IT_KEY1;
  1140.     setsize (self, '-16 -16 -24', '16 16 32');
  1141.     StartItem ();
  1142. };
  1143.  
  1144. /*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32)
  1145. GOLD key
  1146. In order for keys to work
  1147. you MUST set your maps
  1148. worldtype to one of the
  1149. following:
  1150. 0: medieval
  1151. 1: metal
  1152. 2: base
  1153. */
  1154.  
  1155. void() item_key2 =
  1156. {
  1157.     if (world.worldtype == 0)
  1158.     {
  1159.         precache_model ("progs/w_g_key.mdl");
  1160.         setmodel (self, "progs/w_g_key.mdl");
  1161.         self.netname = "gold key";
  1162.     }
  1163.     if (world.worldtype == 1)
  1164.     {
  1165.         precache_model ("progs/m_g_key.mdl");
  1166.         setmodel (self, "progs/m_g_key.mdl");
  1167.         self.netname = "gold runekey";
  1168.     }
  1169.     if (world.worldtype == 2)
  1170.     {
  1171.         precache_model2 ("progs/b_g_key.mdl");
  1172.         setmodel (self, "progs/b_g_key.mdl");
  1173.         self.netname = "gold keycard";
  1174.     }
  1175.     key_setsounds();
  1176.     self.touch = key_touch;
  1177.     self.items = IT_KEY2;
  1178.     setsize (self, '-16 -16 -24', '16 16 32');
  1179.     StartItem ();
  1180. };
  1181.  
  1182.  
  1183.  
  1184. /*
  1185. ===============================================================================
  1186.  
  1187. END OF LEVEL RUNES
  1188.  
  1189. ===============================================================================
  1190. */
  1191.  
  1192. void() sigil_touch =
  1193. {
  1194. local entity    stemp;
  1195. local float        best;
  1196.  
  1197.     if (other.classname != "player")
  1198.         return;
  1199.     if (other.health <= 0)
  1200.         return;
  1201.  
  1202.     centerprint (other, "You got the rune!");
  1203.  
  1204.     sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  1205.     stuffcmd (other, "bf\n");
  1206.     self.solid = SOLID_NOT;
  1207.     self.model = string_null;
  1208.     serverflags = serverflags | (self.spawnflags & 15);
  1209.     self.classname = "";        // so rune doors won't find it
  1210.     
  1211.     activator = other;
  1212.     SUB_UseTargets();                // fire all targets / killtargets
  1213. };
  1214.  
  1215.  
  1216. /*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
  1217. End of level sigil, pick up to end episode and return to jrstart.
  1218. */
  1219.  
  1220. void() item_sigil =
  1221. {
  1222.     if (!self.spawnflags)
  1223.         objerror ("no spawnflags");
  1224.  
  1225.     precache_sound ("misc/runekey.wav");
  1226.     self.noise = "misc/runekey.wav";
  1227.  
  1228.     if (self.spawnflags & 1)
  1229.     {
  1230. //        precache_model ("progs/end1.mdl"); // AXXSH DELETE
  1231.         setmodel (self, "progs/end1.mdl");
  1232.     }
  1233.     if (self.spawnflags & 2)
  1234.     {
  1235. //        precache_model2 ("progs/end2.mdl"); // AXXSH DELETE
  1236.         setmodel (self, "progs/end2.mdl");
  1237.     }
  1238.     if (self.spawnflags & 4)
  1239.     {
  1240. //        precache_model2 ("progs/end3.mdl"); // AXXSH DELETE
  1241.         setmodel (self, "progs/end3.mdl");
  1242.     }
  1243.     if (self.spawnflags & 8)
  1244.     {
  1245. //        precache_model2 ("progs/end4.mdl"); // AXXSH DELETE
  1246.         setmodel (self, "progs/end4.mdl");
  1247.     }
  1248.     
  1249.     self.touch = sigil_touch;
  1250.     setsize (self, '-16 -16 -24', '16 16 32');
  1251.     StartItem ();
  1252. };
  1253.  
  1254. /*
  1255. ===============================================================================
  1256.  
  1257. POWERUPS
  1258.  
  1259. ===============================================================================
  1260. */
  1261.  
  1262. void() powerup_touch;
  1263.  
  1264.  
  1265. void() powerup_touch =
  1266. {
  1267. local entity    stemp;
  1268. local float        best;
  1269.  
  1270. local   float x,a,b,c; // AXXSH
  1271.  
  1272.     if ((other.classname != "player") && (other.classname != "cbot"))
  1273. // if (other.classname != "player") // Original code
  1274.         return;
  1275.     if (other.health <= 0)
  1276.         return;
  1277. if (other.classname == "player")    {    // AXXEL
  1278.  
  1279.     sprint (other, "You got the ");
  1280.     sprint (other, self.netname);
  1281.     sprint (other,"\n");
  1282.     stuffcmd (other, "bf\n");
  1283. } // AXXEL
  1284.  
  1285.     if (deathmatch)
  1286.     {
  1287.         self.mdl = self.model;
  1288.         
  1289.         if ((self.classname == "item_artifact_invulnerability") ||
  1290.             (self.classname == "item_artifact_invisibility"))
  1291.             self.nextthink = time + 60*5;
  1292.         else
  1293.             self.nextthink = time + 60;
  1294.         
  1295.         self.think = SUB_regen;
  1296.     }    
  1297.  
  1298.     sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  1299.     self.solid = SOLID_NOT;
  1300.     other.items = other.items | self.items;
  1301.     self.model = string_null;
  1302.  
  1303. // do the apropriate action
  1304.     if (self.classname == "item_artifact_envirosuit")
  1305.     {
  1306.         other.rad_time = 1;
  1307.         other.radsuit_finished = time + 30;
  1308.     }
  1309.  
  1310.  
  1311.     if (self.classname == "item_artifact_invulnerability")
  1312.     {
  1313.         other.invincible_time = 1;
  1314.         other.invincible_finished = time + 30;
  1315.     }
  1316.     
  1317.     if (self.classname == "item_artifact_invisibility")
  1318.     {
  1319.         other.invisible_time = 1;
  1320.         other.invisible_finished = time + 30;
  1321.     }
  1322.  
  1323.     if (self.classname == "item_artifact_super_damage")
  1324.     {
  1325.         other.super_time = 1;
  1326.         other.super_damage_finished = time + 30;
  1327.     }    
  1328.  
  1329.     activator = other;
  1330.     SUB_UseTargets();                // fire all targets / killtargets
  1331. };
  1332.  
  1333.  
  1334.         
  1335. /*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
  1336. Player is invulnerable for 30 seconds
  1337. */
  1338. void() item_artifact_invulnerability =
  1339. {
  1340.     self.touch = powerup_touch;
  1341.  
  1342.     precache_model ("progs/invulner.mdl");
  1343.     precache_sound ("items/protect.wav");
  1344.     precache_sound ("items/protect2.wav");
  1345.     precache_sound ("items/protect3.wav");
  1346.     self.noise = "items/protect.wav";
  1347.     setmodel (self, "progs/invulner.mdl");
  1348.     self.netname = "Pentagram of Protection"; 
  1349.     self.items = IT_INVULNERABILITY;
  1350.     setsize (self, '-16 -16 -24', '16 16 32');
  1351.     StartItem ();
  1352. };
  1353.  
  1354. /*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
  1355. Player takes no damage from water or slime for 30 seconds
  1356. */
  1357. void() item_artifact_envirosuit =
  1358. {
  1359.     self.touch = powerup_touch;
  1360.  
  1361.     precache_model ("progs/suit.mdl");
  1362.     precache_sound ("items/suit.wav");
  1363.     precache_sound ("items/suit2.wav");
  1364.     self.noise = "items/suit.wav";
  1365.     setmodel (self, "progs/suit.mdl");
  1366.     self.netname = "Biosuit";
  1367.     self.items = IT_SUIT;
  1368.     setsize (self, '-16 -16 -24', '16 16 32');
  1369.     StartItem ();
  1370. };
  1371.  
  1372.  
  1373. /*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
  1374. Player is invisible for 30 seconds
  1375. */
  1376. void() item_artifact_invisibility =
  1377. {
  1378.     self.touch = powerup_touch;
  1379.  
  1380.     precache_model ("progs/invisibl.mdl");
  1381.     precache_sound ("items/inv1.wav");
  1382.     precache_sound ("items/inv2.wav");
  1383.     precache_sound ("items/inv3.wav");
  1384.     self.noise = "items/inv1.wav";
  1385.     setmodel (self, "progs/invisibl.mdl");
  1386.     self.netname = "Ring of Shadows";
  1387.     self.items = IT_INVISIBILITY;
  1388.     setsize (self, '-16 -16 -24', '16 16 32');
  1389.     StartItem ();
  1390. };
  1391.  
  1392.  
  1393. /*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
  1394. The next attack from the player will do 4x damage
  1395. */
  1396. void() item_artifact_super_damage =
  1397. {    
  1398.     self.touch = powerup_touch;
  1399.     
  1400.     precache_model ("progs/quaddama.mdl");
  1401.     precache_sound ("items/damage.wav");
  1402.     precache_sound ("items/damage2.wav");
  1403.     precache_sound ("items/damage3.wav");
  1404.     self.noise = "items/damage.wav";
  1405.     setmodel (self, "progs/quaddama.mdl");
  1406.     self.netname = "Quad Damage";
  1407.     self.items = IT_QUAD;
  1408.     setsize (self, '-16 -16 -24', '16 16 32');
  1409.     StartItem ();
  1410. };
  1411.  
  1412.  
  1413.  
  1414. /*
  1415. ===============================================================================
  1416.  
  1417. PLAYER BACKPACKS
  1418.  
  1419. ===============================================================================
  1420. */
  1421.  
  1422. // AXXEB START
  1423.  
  1424. void() backpack_explode =
  1425. {
  1426.     self.takedamage = DAMAGE_NO;
  1427.     self.classname = "explo_backpack";
  1428.     if ( damage_attacker.classname != "explo_backpack" ) // Does this work with chainexplosions?
  1429.         self.enemy = damage_attacker;
  1430.     // bprint (self.enemy.netname);
  1431.     // did say self.owner
  1432.     T_RadiusDamage (self, self, 160, world);
  1433.     sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
  1434.     particle (self.origin, '0 0 0', 75, 255);
  1435.     self.origin_z = self.origin_z + 32;
  1436.     BecomeExplosion ();
  1437. };
  1438. // AXXEB END
  1439.  
  1440. void() BackpackTouch =
  1441. {
  1442.     local  string    s;
  1443.     local    float    best, old, new;
  1444.     local    entity    stemp;
  1445. //    local    float    acount;    // AXXEL REMOVE
  1446.  
  1447.  
  1448.     
  1449. if ((other.classname != "player") && (other.classname != "cbot")) // AXXEL
  1450. //    if (other.classname != "player") // Original code
  1451.     {
  1452.  
  1453. // fix to prevent backpack from falling through floor.
  1454.         if (self.movetype && other == world)
  1455.         {
  1456.             traceline (self.origin + '10 10 16', self.origin + '-10 -10 -32', TRUE
  1457.                     , other);
  1458.             best = trace_endpos_z;
  1459.             traceline (self.origin + '-10 -10 16', self.origin + '10 10 -32', TRUE
  1460.                     , other);
  1461.             if (trace_endpos_z > best)
  1462.                 best = trace_endpos_z;
  1463.             self.origin_z = best;
  1464.             setorigin(self, self.origin);
  1465.             self.velocity = '0 0 0';
  1466.             self.movetype = MOVETYPE_NONE;
  1467.         }
  1468.         return;
  1469.     }
  1470.  
  1471.  
  1472.     if (other.health <= 0)
  1473.         return;
  1474.  
  1475. // if the player was using his best weapon, change up to the new one if better          
  1476.     stemp = self;
  1477.     self = other;
  1478.     if (self.classname == "player")    // AXXEL
  1479.       best = W_BestWeapon();
  1480.     else                    // AXXEL
  1481.       best = cbot_best_weapon();    // AXXEL
  1482.     self = stemp;
  1483.  
  1484.  
  1485. //    acount = 0;    // AXXEL REMOVE
  1486.  
  1487. // AXXEL START
  1488.     if (self.classname == "player")    
  1489.     {    sprint (other, "You get ");
  1490.  
  1491.       if (self.ammo_shells)
  1492.       {
  1493.           s = ftos(self.ammo_shells);
  1494.           sprint (other, s);
  1495.           sprint (other, " shells  ");
  1496.       }
  1497.       if (self.ammo_nails)
  1498.       {
  1499.           s = ftos(self.ammo_nails);
  1500.           sprint (other, s);
  1501.           sprint (other, " nails ");
  1502.       }
  1503.       if (self.ammo_rockets)
  1504.       {
  1505.           s = ftos(self.ammo_rockets);
  1506.           sprint (other, s);
  1507.           sprint (other, " rockets  ");
  1508.       }
  1509.       if (self.ammo_cells)
  1510.       {
  1511.           s = ftos(self.ammo_cells);
  1512.           sprint (other, s);
  1513.           sprint (other, " cells  ");
  1514.       }
  1515.     
  1516.       sprint (other, "\n");
  1517.       stuffcmd (other, "bf\n");
  1518.     }
  1519. // AXXEL END
  1520. // AXXEL Original Code start
  1521. //    if (self.ammo_shells)
  1522. //    {
  1523. //        if (acount)
  1524. //            sprint(other, ", ");
  1525. //        acount = 1;
  1526. //        s = ftos(self.ammo_shells);
  1527. //        sprint (other, s);
  1528. //        sprint (other, " shells");
  1529. //    }
  1530. //    if (self.ammo_nails)
  1531. //    {
  1532. //        if (acount)
  1533. //            sprint(other, ", ");
  1534. //        acount = 1;
  1535. //        s = ftos(self.ammo_nails);
  1536. //        sprint (other, s);
  1537. //        sprint (other, " nails");
  1538. //    }
  1539. //    if (self.ammo_rockets)
  1540. //    {
  1541. //        if (acount)
  1542. //            sprint(other, ", ");
  1543. //        acount = 1;
  1544. //        s = ftos(self.ammo_rockets);
  1545. //        sprint (other, s);
  1546. //        sprint (other, " rockets");
  1547. //    }
  1548. //    if (self.ammo_cells)
  1549. //    {
  1550. //        if (acount)
  1551. //            sprint(other, ", ");
  1552. //        acount = 1;
  1553. //        s = ftos(self.ammo_cells);
  1554. //        sprint (other, s);
  1555. //        sprint (other, " cells");
  1556. //    }
  1557. //    sprint (other, "\n");
  1558. // AXXEL Original code end
  1559.  
  1560. // backpack touch sound
  1561. sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  1562.  
  1563. // change to a better weapon if appropriate
  1564.     if ( other.weapon == best )
  1565.     {
  1566.         stemp = self;
  1567.         self = other;
  1568.         if (self.classname == "player")
  1569.           self.weapon = W_BestWeapon();
  1570.         else
  1571.           self.weapon = cbot_best_weapon();
  1572.         self = stemp;
  1573.     }
  1574.  
  1575.     remove(self);
  1576.     
  1577.     self = other;
  1578.  
  1579. // AXXEL START
  1580.     if (self.classname == "cbot")
  1581.       cbot_set_ammo();
  1582. // AXXEL END
  1583.  
  1584.     if (self.classname == "player")    // AXXEL
  1585.       W_SetCurrentAmmo ();
  1586.  
  1587. };
  1588.  
  1589.  
  1590. /*
  1591. ===============
  1592. DropBackpack
  1593. ===============
  1594. */
  1595.  
  1596. void() DropBackpack =
  1597. {
  1598.     local entity    item;
  1599.  
  1600.     if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
  1601.         return;    // nothing in it
  1602.  
  1603.     item = spawn();
  1604.     setorigin (item, self.origin - '0 0 24');    
  1605.     
  1606.     item.classname = "backpack";
  1607.     item.items = self.weapon;
  1608.  
  1609. // AXXEL BEGIN Delete
  1610. //    if (item.items == IT_AXE)
  1611. //        item.netname = "Axe";
  1612. //    else if (item.items == IT_SHOTGUN)
  1613. //        item.netname = "Shotgun";
  1614. //    else if (item.items == IT_SUPER_SHOTGUN)
  1615. //        item.netname = "Double-barrelled Shotgun";
  1616. //    else if (item.items == IT_NAILGUN)
  1617. //        item.netname = "Nailgun";
  1618. //    else if (item.items == IT_SUPER_NAILGUN)
  1619. //        item.netname = "Super Nailgun";
  1620. //    else if (item.items == IT_GRENADE_LAUNCHER)
  1621. //        item.netname = "Grenade Launcher";
  1622. //    else if (item.items == IT_ROCKET_LAUNCHER)
  1623. //        item.netname = "Rocket Launcher";
  1624. //    else if (item.items == IT_LIGHTNING)
  1625. //        item.netname = "Thunderbolt";
  1626. //    else
  1627. //        item.netname = "";
  1628. // AXXEL END DELETE
  1629.  
  1630.     item.ammo_shells = self.ammo_shells;
  1631.     item.ammo_nails = self.ammo_nails;
  1632.     item.ammo_rockets = self.ammo_rockets;
  1633.     item.ammo_cells = self.ammo_cells;
  1634.  
  1635.     item.velocity_z = 300;
  1636.     item.velocity_x = -100 + (random() * 200);
  1637.     item.velocity_y = -100 + (random() * 200);
  1638.     
  1639.     item.flags = FL_ITEM;
  1640.      item.solid = SOLID_TRIGGER;    
  1641.     item.movetype = MOVETYPE_TOSS;
  1642.     setmodel (item, "progs/backpack.mdl");
  1643.     setsize (item, '-16 -16 0', '16 16 56');
  1644.     item.touch = BackpackTouch;
  1645. // AXXEB START    
  1646.     item.health = 30;
  1647.       item.th_die = backpack_explode;
  1648.       item.takedamage = DAMAGE_AIM;
  1649. // AXXEB END
  1650.     item.nextthink = time + 120;    // remove after 120 seconds
  1651.     item.think = SUB_Remove;
  1652.  
  1653. };
  1654.